package cn.turboinfo.dongying.api.domain.admin.usecase.dictconfig;

import cn.turboinfo.dongying.api.domain.common.service.dictconfig.DictConfigService;
import cn.turboinfo.dongying.api.domain.common.usecase.AbstractUseCase;
import cn.turboinfo.dongying.api.entity.common.pojo.dictconfig.DictConfig;
import lombok.*;
import lombok.extern.slf4j.Slf4j;
import net.sunshow.toolkit.core.qbean.api.request.QPage;
import net.sunshow.toolkit.core.qbean.api.request.QRequest;
import net.sunshow.toolkit.core.qbean.api.response.QResponse;
import org.springframework.stereotype.Component;

@Slf4j
@RequiredArgsConstructor
@Component
public class DictConfigSearchUseCase extends AbstractUseCase<DictConfigSearchUseCase.InputData, DictConfigSearchUseCase.OutputData> {
    private final DictConfigService dictConfigService;

    @Override
    protected OutputData doAction(InputData inputData) {

        QResponse<DictConfig> response = dictConfigService.searchList(inputData.request, inputData.getRequestPage());

        return OutputData.builder()
                .qResponse(response)
                .build();
    }

    @EqualsAndHashCode(callSuper = true)
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class InputData extends AbstractUseCase.InputData {
        private QRequest request;

        private QPage requestPage;
    }

    @Getter
    @Setter
    @Builder
    public static class OutputData extends AbstractUseCase.OutputData {
        private QResponse<DictConfig> qResponse;
    }
}
